<!doctype html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
    <meta name="theme-color" content="#e90101"/>
    <title>音乐鉴赏与分享平台</title>
    <meta name="author" content="Themezinho">
    <meta name="description" content="For all kind of video streaming website">
    <meta name="keywords"
          content="digiflex, video, movie, show, tv, watch, online, streaming, stream, ads, trailer, imdb, dram, action, hollywood, cinema, rate">

    <!-- SOCIAL MEDIA META -->
    <meta property="og:description" content="digiflex | Online Movie Streaming">
    <meta property="og:image" content="http://www.themezinho.net/digiflex/preview.png">
    <meta property="og:site_name" content="digiflex">
    <meta property="og:title" content="digiflex">
    <meta property="og:type" content="website">
    <meta property="og:url" content="http://www.themezinho.net/digiflex">

    <!-- TWITTER META -->
    <meta name="twitter:card" content="summary">
    <meta name="twitter:site" content="@digiflex">
    <meta name="twitter:creator" content="@digiflex">
    <meta name="twitter:title" content="digiflex">
    <meta name="twitter:description" content="digiflex | Online Movie Streaming">
    <meta name="twitter:image" content="http://www.themezinho.net/digiflex/preview.png">

    <!-- FAVICON FILES -->

    <link rel="stylesheet" href="layui/css/layui.css">

    <link href="ico/apple-touch-icon-144-precomposed.png" rel="apple-touch-icon" sizes="144x144">
    <link href="ico/apple-touch-icon-114-precomposed.png" rel="apple-touch-icon" sizes="114x114">
    <link href="ico/apple-touch-icon-72-precomposed.png" rel="apple-touch-icon" sizes="72x72">
    <link href="ico/apple-touch-icon-57-precomposed.png" rel="apple-touch-icon">
    <link href="ico/favicon.png" rel="shortcut icon">


    <!-- CSS FILES -->
    <link rel="stylesheet" href="css/lineicons.css">
    <link rel="stylesheet" href="css/fancybox.min.css">
    <link rel="stylesheet" href="css/swiper.min.css">
    <link rel="stylesheet" href="css/bootstrap.min.css">
    <link rel="stylesheet" href="css/style.css">
    <link rel="stylesheet" href="layui/css/layui.css">
</head>
<body>

<div id="iframetop">
</div>

<header class="page-header">
    <div class="container">
        <h4 style="text-align: center">我的上传</h4>
    </div>
</header>



<!-- end slider -->
<main>
    <section class="content-section">
        <div class="container" id="app">
                <div class="col-12">
                    <div class="section-title">
                        <fieldset class="layui-elem-field layui-field-title" style="margin-top: 50px;">
                            <legend>我的上传</legend>
                        </fieldset>
                    </div>

                    </div>
            <div>
                <div class="layui-row">
                    <div class="layui-row layui-col-space5">
                        <table class="layui-table" lay-size="sm">
                            <colgroup>
                                <col width="150">
                                <col width="200">
                                <col>
                            </colgroup>
                            <thead>
                            <tr>
                                <th>歌名</th>
                                <th>类别</th>
                                <th>地区</th>
                                <th>歌手</th>
                                <th>年代</th>
                                <th>发布时间</th>
                                <th>综合评分</th>
                                <th>上传者</th>
                                <th>审核状态</th>
                                <th>操作</th>
                            </tr>
                            </thead>
                            <tbody>
                            <tr v-for="(movie,i) in movielist">
                                <td>{{movie.name}}</td>
                                <td>{{movie.category.name}}</td>
                                <td>{{movie.area.name}}</td>
                                <td>{{movie.author}}</td>
                                <td>{{movie.yeartime}}</td>
                                <td>{{movie.playtime}}</td>
                                <td>{{movie.score}}</td>
                                <td>{{movie.memberid == '0'?'管理员':movie.member.tname}}</td>
                                <td>{{movie.shstatus}}</td>
                                <td>
                                    <a :href="['myuploadedit.html?id='+movie.id+'&pageNum='+pageNum+'&key='+key]"><i class="layui-icon layui-icon-edit"></i>  </a>
                                    <a href="javascript:;" @click="del(movie.id)"><i class="layui-icon layui-icon-delete"></i>  </a>

                                </td>
                            </tr>
                            <Tr>
                                <td colspan="2"><button type="button" class="btn btn-primary btn-xs" @click="add()"><i class="layui-icon layui-icon-add-1"></i></button></td>
                                <Td colspan="8"><div id="demo1" style="text-align: center"></div></Td></Tr>
                            </tbody>
                        </table>


                    </div>

                </div>

            </div>
                </div>






        </div>
        <!-- end container -->
    </section>
    <footer class="footer">
        <!-- end container -->
        <div class="bottom-bar" id="iframefoot">
            <!-- end container -->
        </div>
        <!-- end bottom-bar -->
    </footer>
    <!-- end footer -->
</main>

<!-- JS FILES -->
<script src="js/jquery.min.js"></script>
<script src="js/bootstrap.min.js"></script>
<script src="js/swiper.min.js"></script>
<script src="js/fancybox.min.js"></script>
<script src="js/scripts.js"></script>


<script type="text/javascript" src="axios/vue.js"></script>
<script type="text/javascript" src="axios/axios.min.js"></script>
<script type="text/javascript" src="axios/qs.js"></script>
<script type="text/javascript" src="axios/getUrlParams.js"></script>
<script type="text/javascript" src="layer/layer.js"></script>
<script type="text/javascript" src="layui/layui.js"></script>

<script type="text/javascript">

    var qs = Qs
    var pageNum = UrlParam.paramValues("pageNum")==null?1:UrlParam.paramValues("pageNum").toString()
    var key = UrlParam.paramValues("key")==null?"":UrlParam.paramValues("key").toString()


    var vmm=new Vue({
        el:'#app',
        data:{
            key:key,
            movielist:[],
            pageSize:10,
            pageNum:pageNum,
        },
        mounted(){
            this.getmovielist()
        },
        methods: {

            add(){
                location.replace("myuploadadd.html")
            },


            del(id){
                axios.post('admin/movieDel',qs.stringify({
                    id:id,
                })).then(response =>{
                    this.getmovielist()
            }).catch(error =>{
                    console.log(error)
            })
            },



            getmovielist() {
                axios.post('myUploadList',qs.stringify({
                    key:this.key,
                    pageSize:this.pageSize
                })).then(response =>{
                    layui.use(['laypage', 'layer'], function(){
                    var laypage = layui.laypage
                        ,layer = layui.layer;
                    //总页数大于页码总数
                    laypage.render({
                        elem: 'demo1'
                        ,theme:"#2b303a"
                        ,limit:vmm.pageSize
                        ,curr:vmm.pageNum
                        ,count: response.data.list.length //数据总数
                        ,jump: function(obj,first){
                            vmm.pageNum = obj.curr
                            vmm.current_page(obj.curr,vmm.pageSize)
                            console.log(obj.curr); //得到当前页，以便向服务端请求对应页的数据。
                        }
                    });
                });
            }).catch(error =>{
                    console.log(error)
            })
            },


            current_page(page,pageSize){
                axios.post('myUploadList',qs.stringify({
                    key:this.key,
                    pageNum:page,
                    pageSize:pageSize,
                })).then(response =>{
                    this.movielist = response.data.pageInfo.list
                console.log(this.movielist)
            }).catch(error =>{
                    console.log(error)
            })
            },
        },

    })

    window.onload = function(){
        $("#iframetop").load("top.html")
        $("#iframefoot").load("foot.html")

    }
</script>
</body>
</html>